function flattenObj(obj) {
	let res = {}
	for (let key in obj) {
		if (typeof obj[key] === 'object' && obj[key] !== null) {
			flatten(res, obj[key], `${key}`)
		} else {
			res[key] = obj[key]
		}
	}


	function flatten(res, obj, keyname) {
		for (let key in obj) {
			if (typeof obj[key] === 'object' && obj[key] !== null) {
				flatten(res, obj[key], `${keyname}.${key}`)
			} else {
				res[`${keyname}.${key}`] = obj[key]
			}
		}
	}
	return res
}
